import java.util.Random;


public class MatrixGenerator {
	
	public int[][] randomMatrixGenerator(int n) {
		int[][] matrix = new int[n][n];
		Random rand = new Random();
		int randNumber;
		
		for(int i=0; i < n; i++) {
			for(int j=0; j < n; j++) {
				randNumber = rand.nextInt(2);
				matrix[i][j] = randNumber;
			}
		}
		
		return matrix;
	}
	
	public int[][] coopMatrixGenerator(int n, int[] posMatrix) {
		int[][] matrix = new int[n][n];
		int positionCount = -1;
		
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				positionCount++;
				matrix[i][j] = 0;
				for (int k = 0; k < posMatrix.length; k++) {
					if (positionCount == posMatrix[k]) {
						matrix[i][j] = 1;
					}
				}
			}
		}
		
		return matrix;
	}
	
	public int[][] givenPositionMatrixGenerator(int n, int[] position, int[] strategy) {
		int[][] matrix = new int[n][n];
		Random rand = new Random();
		int randNumber, positionCount = -1;
		
		for(int i=0; i < n; i++) {
			for(int j=0; j < n; j++) {
				positionCount++;
				for(int k=0; k<position.length; k++) {
					if (positionCount == position[k]) {
						matrix[i][j] = strategy[k];
					} else {
						randNumber = rand.nextInt(2);
						matrix[i][j] = randNumber;
					}
				}
			}
		}
		
		return matrix;
	}
}
